﻿// Decompiled with JetBrains decompiler
// Type: DnProcessSimulateCommands.CUiAssignDataFromTCCmd
// Assembly: DnProcessSimulateCommands, Version=2402.0.0.890, Culture=neutral, PublicKeyToken=null
// MVID: A885D881-AEDF-447E-852A-6F13102E089C
// Assembly location: C:\Program Files\Tecnomatix_2402\eMPower\DotNetCommands\DnProcessSimulateCommands.dll

using DnProcessSimulateCommands.AssignDataFromTC;
using EngineeringInternalExtension;
using EngineeringInternalExtension.Utilities;
using System.Windows;
using System.Windows.Forms;
using Tecnomatix.Engineering;
using Tecnomatix.Engineering.Ui;


namespace DnProcessSimulateCommands;

public class CUiAssignDataFromTCCmd : TxButtonCommand
{
  private CApAssignDataFromTCCmdEnabler m_enabler;

  public CUiAssignDataFromTCCmd() => this.m_enabler = new CApAssignDataFromTCCmdEnabler();

  public virtual string Category => AssignDataFromTCResources.CMD_CATEGORY;

  public virtual string Name => AssignDataFromTCResources.CMD_NAME;

  public virtual string Tooltip => AssignDataFromTCResources.CMD_TOOLTIP;

  public virtual string Description => AssignDataFromTCResources.CMD_DESCRIPTION;

  public virtual string Bitmap => AssignDataFromTCResources.CMD_BITMAP;

  public virtual string LargeBitmap => AssignDataFromTCResources.CMD_LARGE_BITMAP;

  public virtual ITxImage Image
  {
    get => (ITxImage) TxImageManager.GetImageByKey("AssignDataFromTeamcenter");
  }

  public virtual ITxCommandEnabler CommandEnabler => (ITxCommandEnabler) this.m_enabler;

  public virtual void Disconnect()
  {
    if (this.m_enabler != null)
      this.m_enabler.UnregisterFromEvents();
    base.Disconnect();
  }

  public virtual void Execute(object cmdParams)
  {
    if (CApPSSessionData.GetStructuresAvailability != CApStructuresAvailability.None)
    {
      if (TxTcSessionInfoEx.CheckViewsAvailability())
        ((Window) new CUiAssignDataFromTCWindow()).Show();
      else
        TxErrorStackDlg.DisplayErrors();
    }
    else
    {
      int num = (int) TxMessageBox.Show("No structures available for search. The command will not open.", AssignDataFromTCResources.CMD_NAME, MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
    }
  }
}
